package com.acme.bankapp.domain;

import java.util.ArrayList;
import java.util.List;

import com.acme.bankapp.domain.accounting.Account;

/**
 * domain client
 */
public class Client {
	
	final private String name;
	final private Gender gender;

	//[EK] XXX why Creator pattern not DI?
	//accounts list is controlled by addAccount(),
	//account has no point without Client, so no point in setAccounts() method 
	private List<Account> accounts = new ArrayList<Account>();
	
	Client(String name, Gender gender){
		this.name = name;
		this.gender = gender;
	}

	Client(String name){
		this(name, Gender.MALE);
	}


	
	public List<Account> getAccounts(){
		return accounts;
	}
	
	public String getClientSalutation(){
		return gender.getDesc()+ " "+name;
	}
	
	void addAccount(Account account){
		accounts.add(account);
	}

	public Gender getGender() {
		return gender;
	}
	public String getName() {
		return name;
	}
	
}
